#include <iostream>
using std::cout;
using std::endl;

class Base
{
public:
    Base(long base)
    : _base(base)
    {
        cout << "Base()" << endl;
    }

    void print() const{
        cout << _base << endl;
    }

    ~Base(){
        cout << "~Base()" << endl;
    }
private:
    long _base = 10;
};


class Test{
public:
    Test(long test)
    : _test(test)
    { 
        cout << "Test()" << endl; 
    }
    ~Test(){ 
        cout << "~Test()" << endl;
    }
private:
    long _test;
};



class Derived
: public Base
{
public:
    Derived(long base,long derived,long test,long ba1)
    : Base(base)//显式调用基类构造函数，初始化基类子对象
    , _derived(derived)
    , _te(test)//显式调用对象成员的构造函数，初始化成员子对象
    , _b1(ba1)//显示调用对象成员的构造函数（基类类型的成员子对象）
    {
        cout << "Derived()" << endl;
    }

    ~Derived(){
        cout << "~Derived()" << endl;
    }
private:
    long _derived = 100;
    Test _te;
    Base _b1;
};


void test0(){
    /* cout << sizeof(Base) << endl; */
    cout << sizeof(Derived) << endl;
    Derived d1(1,2,3,4);

}

int main(void){
    test0();
    return 0;
}
